package com.link.wseller.mapper.impl;

import com.link.wseller.domain.ProductCategory;
import com.link.wseller.domain.ProductInfo;
import com.link.wseller.mapper.ProductCategoryMapper;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;

import java.util.List;

@Mapper
public interface ProductCategoryMapperImpl extends ProductCategoryMapper{

    @Select("select * from product_category")
    @Results({
            @Result(column="category_id", property="categoryId", jdbcType=JdbcType.INTEGER, id=true),
            @Result(column="category_name", property="categoryName", jdbcType=JdbcType.VARCHAR),
            @Result(column="category_type", property="categoryType", jdbcType=JdbcType.INTEGER),
            @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
            @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP)
    })
    List<ProductCategory> findAll();

    @Select("select * from product_category where category_type in (#{types})")
    @Results({
            @Result(column="category_id", property="categoryId", jdbcType= JdbcType.INTEGER, id=true),
            @Result(column="category_name", property="categoryName", jdbcType=JdbcType.VARCHAR),
            @Result(column="category_type", property="categoryType", jdbcType=JdbcType.INTEGER),
            @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
            @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP)
    })
    List<ProductCategory> findByCategoryTypeIn(@Param("types") String types);
}
